package mcu.market.net.model;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import mcu.market.ibatis.IBatisFactory;
import mcu.market.ibatis.bean.BeanCompany;

import org.apache.ibatis.session.SqlSession;

public abstract class getPriceDataModel extends getSwtDataModel{
	List<BeanCompany> companyList;
	public int IPO=0;
	public int OTC=1;
	/**
	 * 股價是否出來判斷日期
	 * @return
	 */
	public Date checkData() {
		Date date=new Date();
		Calendar calendar = Calendar.getInstance();
	    calendar.add(Calendar.DATE, -1);
	    Date yesterday = calendar.getTime();
	    if(date.getHours()>16){
	    	return date;
	    }
		return yesterday;
	}
	public List getCompanyList() {
		return this.companyList;
	}

	public void setCompanyList(int type) {
		SqlSession sqlSession=IBatisFactory.getInstance().getSqlSession();
		BeanCompany bc=new BeanCompany();
		bc.setType(type);
		List company_list=sqlSession.selectList("company.selectTypeCompany",bc);
		this.companyList = company_list;
		sqlSession.close();
	}
}
